package com.xqboss.common.annotation;

import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.xqboss.common.core.text.DataMaskingSerializer;
import com.xqboss.common.core.text.PercentDeserialize;
import com.xqboss.common.core.text.PercentSerializer;

import java.lang.annotation.*;

/**
 * 用于给后端接口百分比转换用，字段类型仅支持BigDecimal，注解在返回值时，会自动乘以100，注解在请求参数时：会自动除以100
 */
@Target({ElementType.FIELD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@JacksonAnnotationsInside
@JsonSerialize(using = PercentSerializer.class)
@JsonDeserialize(using = PercentDeserialize.class)
public @interface PercentFormat {
}
